const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');

const cssLoader = {
  loader: 'css-loader',
  options: {
    modules: {
      mode: 'global',
      localIdentName: '[hash:base64]',
    },
  },
};

module.exports = merge(common, {
  mode: 'production',
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: ['style-loader', cssLoader],
      },
      {
        test: /\.s[ac]ss$/i,
        use: ['style-loader', cssLoader, 'sass-loader'],
      },
    ],
  },
});
